chore: auto-fix eslint issues in post-edit hook#2313
Merged
Conversation
The PostToolUse hook ran prettier --write then a report-only `pnpm run lint`. Fixable eslint issues at warning severity (e.g. import/order) were never corrected and never failed lint, so they leaked into commits and had to be fixed manually with `eslint --fix`. Add an `eslint --fix "$FILE_PATH"` pass after prettier and before the report-only lint, scoped to the edited file (matching the prettier step). This auto-corrects all eslint-fixable rules on each edit while the final lint pass still gates on errors.
gjulivan
approved these changes
Jul 7, 2026
iobuhov
approved these changes
Jul 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull request type
Refactoring (e.g. file rename, variable rename, etc.)
Description
What: The Claude Code / Copilot
PostToolUsehook (.claude/hooks/post-edit.sh) now runseslint --fixon the edited file afterprettier --writeand before the report-only lint pass.Why: The hook previously ran
prettier --write(which does not reorder imports) then a report-onlypnpm run lint. Fixable eslint issues at warning severity — notablyimport/order— were never auto-corrected and never failed lint (warnings keep the exit code at 0). They leaked into commits and had to be fixed manually witheslint --fix.Change: Add a single-file
eslint --fix "$FILE_PATH"step, scoped andcd-ed the same way as the existing prettier step. It auto-corrects every eslint-fixable rule (import order,prefer-const, etc.) on each edit; the finalpnpm run lintstill gates on errors.Verified by piping a simulated
PostToolUsepayload ({"tool_input":{"file_path":"…"}}) for a file with out-of-order imports through the hook — imports were reordered and the hook exited 0.What should be covered while testing?
.ts/.tsxfile in a widget package so it has a fixable eslint issue (e.g. imports out of order).